import React from 'react';
import {connect} from 'dva';
import './index.less';
import {Button, BaseComponent} from '../../../../components/Base';

import $$, {store} from '../../../../utils';


@connect()
export default class extends BaseComponent {

  constructor(props) {
    super(props);

    // this.testStore();
    this.lisAction();
  }

  testStore = () => {

    store.create('shan').setStore('key1', 'key1').setStore('key2', 'key2');
    const value = store.create('shan').getStoreInfo();
    $$.info('shan', value);

    const value1 = store.create('dong').getStoreInfo();
    $$.info('dong', value1);
  }

  lisAction = () => {
    $$.on('event1', (args) => {
      $$.info('收到事件', args);
    })
  }

  render() {

    return (
      <div >
        <Button onClick={() => {
          $$.trigger('event1', '参数1', '参数2');
        }}> 发送事件 </Button>
      </div>
    );
  }
}
